Skip to content

Add WaveReadLaneAt tests #349

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Aug 18, 2025

Conversation

bob80905
Copy link
Contributor

This PR implements testing for the WaveReadLaneAt intrinsic. It's an improved copy of @inbelic's work here: #295

  • WaveReadLaneAt.[16|32|64].test adds testing of the basic types (and vectors)
  • WaveReadLaneAt.udt.test adds testing for a matrix, user defined struct and for floating point edge-case values
  • WaveReadLaneAt.index.test adds testing of various use-cases with different indices

Resolves: #144

...
#--- end

# REQUIRES: Double, Int64
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bogner, I know we were talking about needing to double up testing, but I'm curious for your thoughts on this one.

Combining double and int64 in the same test means we don't run this on devices that only support one or the other. While I think int64 is fairly universal at this point because 64-bit pointer math kinda requires it, there are a number of mobile architectures that don't support double (including Apple GPUs).

Does it make sense to combine 64-bit types or should we split them?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, splitting these makes sense. I suspect as a rule of thumb any time we're REQUIREing two different features in these tests we should probably split them up for maximum test coverage.

int NegValue = WaveReadLaneAt(InInt[TID.x], NegShiftIndex);
OutShift[TID.x] = PosValue + NegValue;

uint MixIndex = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also have a test where WaveReadLaneAt is called in one or more switch statement cases?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be careful using switch statements in tests. They should be fine as long as no case labels have fall through. Even trivial fall through is UB in SPIRV.

Copy link
Contributor

@inbelic inbelic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just if we should split up the testcase as mentioned

@@ -0,0 +1,181 @@
#--- source.hlsl
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be bool tests for WaveReadLaneAt? I see that it supports bool in the HLSL headers

@bob80905 bob80905 merged commit 44c9a64 into llvm:main Aug 18, 2025
36 of 46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add test for WaveReadLaneAt
6 participants